<!DOCTYPE html>
<extend name="Base/base" />
<block name='head'>  
    <meta charset="utf-8">
    <link href="/Public/Index/css/workflow.css" rel="stylesheet" /> 
    <style type="text/css">
        .t4{color:#bbb}
        /*出差小结－转交下一步骤开始*/
/*        .trip_title h2 {
            font-size:1.2em;
            margin:1.2em;
            color:#5077aa;
        }
        .trip_next h3{
            font-size:1em;
            padding:0.8em;
        }
        .trip_next table{
            width:100%;
            border:1px solid red;
        }
        .trip_next table tr td{
            border:1px solid #CFDDEA;
            font-size:1.0em;
            padding:0.3em 0;
            text-align: center;
        }
        .trip_next table .value{
            width:80%;
            text-align: left;
            padding-left:10px;
        }
        .trip_next table .key{
            width:20%;
            text-align: center;
            background: #F0F0F0;
        }*/
        .top{
            height:5px;
        }
        .bottom{
            height:20px;
        
        .comments{
            border:3px solid #CFDDEA;
        }
        .com1 {
            width:10%;
            font-weight:inherit;
            text-align:left;
        }
        
        .fil{
            border:1px solid #CFDDEA;
        }
    </style>
</block>
<block name="content" > 
    <form id="myform">
        <div class="bd">
            <div class="trip_title">
                <h2>新闻查询</h2>
            </div>
            <div class="work_cells trip_next">
                <p class="top"></p>
                <table>
                    <tr>
                        <td class="key">发布人</td>
                        <td class="text_value"><input type='text' name='provider' id="provider" ></td>
                    </tr>
                    <tr>
                        <td class="key">新闻标题</td>
                        <td class="text_value"><input type='text' name='subject' id="subject" ></td>
                    </tr>
                    <tr>
                        <td class="key">新闻类型</td>
                        <td class="text_value">
                            <select name="type_id" id="type_id" >
                                <option value="0">全部</option>
                                <option value="1">公司新闻</option>
                                <option value="2">行业新闻</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="key">发布日期</td>
                        <td class="text_value">
                            <input type="text" style='border:1px solid #E5E5E5;width:35%;' id="start" class="dateTime" name="start" placeholder="双击打开日历">&nbsp;至&nbsp;
                            <input type="text" style='border:1px solid #E5E5E5;width:35%;' id="end" class="dateTime" name="end" placeholder="双击打开日历">
                            <input type="hidden" id="url" value="{:U('getDate')}">
                        </td>
                    </tr>
                    <tr>
                        <td class="key">新闻内容</td>
                        <td class="text_value"><input type='text' name='content' id="content" ></td>
                    </tr>
                </table>
            </div>
            <div class="button" style="margin-left:23%;margin-top:0px;margin-bottom:0px;">
                <span>
                    <a class="pointer btn-submit ajax-post search" data-verify="all" data-form="">查询</a>
                    <a class="pointer btn-submit ajax-post restart" data-verify="all" data-form="">重置</a>
                </span>
            </div>
        </div>
    </form>
    <div class="transferred_table">
        <!--<table border="1">-->
<!--            <tr>
                <td width='60%' style='text-align:left;'>
                    <a href="{:U('show',array('news_id'=>$new['news_id']))}" title="{$new.subject}">{$new.subject_info}</a>
                </td>
                <td><a href="{:U('show',array('news_id'=>$new['news_id']))}">{$new.news_time}</a></td>
            </tr>-->
        <!--</table>-->
        <!--<div class="page">{$pages}</div>-->
        <!--<input type="hidden" id="url" value="{:U('searchNews')}">-->
        <input type="hidden" id="delurl" value="{:U('Diary/delDiary')}">
    </div>
    <p class="bottom"></p>
    <div class="button">
        <a class="am-btn" onclick="history.go(-1)">返 回</a>
    </div>

</block>
<block name="script">
    <script type="text/javascript" src="/Public/Index/js/form.js"></script>
    <script type="text/javascript" src="/Public/Index/js/news.js"></script>
    <script type="text/javascript">
        $(dateTime());
        $(function(){
            $('.search').click(function(){
                var provider = $("#provider").val();
                var type_id = $("#type_id").val();
                var subject = $("#subject").val();
                var date_start = $("#date_start").val();
                var date_end = $("#date_end").val();
                var content = $("#content").val();
                $.post('',{provider:provider,type_id:type_id,subject:subject,date_start:date_start,date_end:date_end,content:content},function(res){
                    console.log(res);
                    var html = '';
                    if (res.length > 0) {
                        var html = '<table><th>新闻标题</th><th>发布时间</th>';
                        for (var i = 0; i < res.length; i++) {
                            var news_id = res[i].news_id;
                            html += '<tr><td width="60%" align="left"><a href="/index.php/Index/News/show/news_id/'+res[i].news_id+'.html" title="'+res[i].subject+'">'+res[i].subject_info+'</a></td><td align="center"><a href="/index.php/Index/News/show/news_id/'+res[i].news_id+'.html">'+res[i].news_time+'</a></td></tr>'
                        }
                        html += '</table>';
                        $('.transferred_table').html(html);
                    }else{
                        html += '<table><tr><td align="center">无符合条件的新闻</td></tr></table>';
                        $('.transferred_table').html(html);
                    }
                })
            })
            
            $('.restart').click(function(){
                $('#myform')[0].reset();
                $('.transferred_table').html('');
            })
        })
    </script>
</block>
